(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('waf.test.pti.dialogsController',
			[ 'modalService', '$scope', '$timeout', function(modalService, $scope, $timeout) {
				var ctrl = this;
				ctrl.openLoading = function() {
					var modalInstance = modalService.openLoading();
					$timeout(function() {
						modalService.closeLoading();
					}, 2000);
				};
				ctrl.openWarningDialogs = function() {
					var resolve = {
						messages : [ 'This is a waring message 1', 'This is a waring message 2', 'This is a waring message 3' ]
					};
					modalService.openWarningDialogs(resolve);
				};
				ctrl.openInfoDialogs = function() {
					var resolve = {
						messages : [ 'This is a info message 1', 'This is a info message 2', 'This is a info message 3' ]
					};
					modalService.openInfoDialogs(resolve);
				};
				ctrl.openErrorDialogs = function() {
					var resolve = {
						messages : [ 'This is a error message 1', 'This is a error message 2', 'This is a error message 3' ]
					};
					modalService.openErrorDialogs(resolve);
				};
				ctrl.openConfirmDialogs = function() {
					modalService.openConfirmDialogs({
						'messages' : [ 'This is a confirm message 1', 'This is a confirm message 2', 'This is a confirm message 3' ],
						'btnCallback' : {
							'ok' : function(result) {
								ctrl.result = result;
							},
							'close' : function(result) {
								ctrl.result = result;
							}
						}
					});
				};
				ctrl.openPromptDialogs = function() {
					modalService.openPromptDialogs({
						'btnCallback' : {
							'ok' : function(promptMesage) {
								ctrl.promptMesage = promptMesage;
							}
						}
					});
				};
				ctrl.openCustomDialogs = function() {
					modalService.openCustomDialogs({
						'dialogsModule' : 'cda.companyType',
						'btnCallback' : {
							'ok' : function(selectedRows) {
								if (!selectedRows || selectedRows.length == 0) {
									modalService.openErrorDialogs({
										messages : [ 'title.dialogs.info.norecsel' ]
									});
									return false;
								}
								ctrl.selectedRows = selectedRows;
							}
						}
					});
				};
			} ]);
})(angular);